import Menu from './menu';
import store from '../store';

//这里可以根据权限做菜单过滤

export default  Menu;

//根据权限进行菜单过滤
let permission = store.state.permission;
let role = store.state.role;

let MenuChildren = Object.values(Menu);

//判断是否为超级管理员
if (role.indexOf('super_admin') === -1) {
    for (let k in MenuChildren) {
    if (MenuChildren[k].children != undefined) {
        for (let v in MenuChildren[k].children ) {
            //判断是否需要过滤权限
           if (MenuChildren[k].children[v].isPer === true) {
               //过滤权限
               if(permission.indexOf(v) === -1) {
                   delete MenuChildren[k].children[v]
               }
           }

        }
    }
}

}

